package cn.kgc.chenxiao.service.Impl;

import cn.kgc.chenxiao.dao.DetailDao;
import cn.kgc.chenxiao.pojo.Detail;
import cn.kgc.chenxiao.service.DetailService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 陈啸
 * @create 2020-01-06 9:21
 */
@Scope("prototype")
@Service("detailService")
public class DetailServiceImpl implements DetailService {
    @Autowired
    DetailDao detailDao;
    @Override
    public List<Detail> getSelect(int categoryId, String title) {
        return detailDao.getSelect(categoryId,title);
    }

    @Override
    public Detail getUpdateById(int id) {
        return detailDao.getUpdateById(id);
    }

    @Override
    public int getUpdate(Detail detail) {
        if(detailDao.getUpdate(detail)>0){
            return 1;
        }
        return 0;
    }

    @Override
    public Detail getByTitle(String title) {
        return detailDao.getByTitle(title);
    }
}
